<%@ page import="util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 커뮤니티 카테고리별 검색시 실행되는 페이저 --%>
<%	request.setCharacterEncoding("UTF-8");
    String path = request.getContextPath();
	String url = request.getParameter("url");
	String method = request.getParameter("method");
	String ccno = request.getParameter("ccno");

	if(url.indexOf("?")==-1) {
		url = url + "?";
	} else {
		url = url + "&";
	}%>
	
<%Pager pager = (Pager) session.getAttribute("pager");%>
<script type="text/javascript">
<!--
	function getPage(flag){
		var u = "<%=path%>"+"<%=url %>";
		u = u + flag;
		u = u + "&ccno=<%=ccno%>";
		location.href = u;
	}
//-->
</script>
<table width="100%" border="0" cellspacing="0">
  <tr>
    <td align="center">
    		<%if(pager.getTotalPages()!=0) {%>
    			<a href="javascript:getPage('firstPageGroup=true');">[First]</a>
    		<%}%>
    		
    		<%if(pager.getCurrentPageGroup()>1) {%>
    			<a href="javascript:getPage('previousPageGroup=<%=pager.getCurrentPageGroup()-1%>');">[Previous]</a>
    		<%}%>
    		
    		<%long startPage = pager.getStartPageOfCurrentPageGroup();
				long currentPage = pager.getCurrentPage();
				long pagesPerGroup = pager.getPagesPerGroup();
				long totalPages = pager.getTotalPages();%>
				
  			<%for(long i=startPage; (i<=totalPages && pagesPerGroup!=0); i++) {%>  						
  					<a href="javascript:getPage('currentPage=<%=i%>');">
  					<%if(i==currentPage) {%>[<b><%=i%></b>]<%} 
  						  else {%>[<%=i%>]<%}%></a> 
  					<%pagesPerGroup--;%>
  		 	<%}%>
    		 
    		<%if(pager.getCurrentPageGroup()<pager.getTotalPageGroups()) {%> 
    				<a href="javascript:getPage('nextPageGroup=<%=pager.getCurrentPageGroup()+1%>');">[Next]</a>    				
    		<%}%>
    		
    		<%if(pager.getTotalPages()!=0) {%>
    				<a href="javascript:getPage('lastPageGroup=true');">[Last]</a>
    		<%}%>
    </td>
  </tr>
</table>